<?php


/**
 * 文章分类管理
 * Enter description here ...
 * @author Admin
 *
 */
class Article_categoriesModel extends CommonModel {

	protected $_validate	 =	 array(
		array('name','require','分类名称必须！'),
	);
	
	
	/**
	 * 获取分类下属所有子分类（递归）
	 * Enter description here ...
	 * @param unknown_type $id
	 */
	public function getChildren($id){
		$map['fid'] = array('eq',$id);
		$data = $this->where($map)->findAll();
		if (!empty($data)){
			foreach ($data as $val){
				$tmpdata[] = $val['id'];
				$tmp = $this->getChildren($val['id']);
				if (!empty($tmp)){
					array_merge($tmpdata,$tmp);
				}
			}
		}
		return $tmpdata;
	}
	
	
}
?>